<?php

/**
 * @author FROSTY (valik619)
 * @site nadmad.ru
 * @mail valik619@inbox.ru
 */
$title = 'WBCMS - wap blogs CMS';
$root = '../';
include('../system/core.php');

$pr=$_GET['id'];  
$namecat = mysql_query("SELECT * FROM `posts` WHERE `id` = '$pr' LIMIT 1");
$nc = mysql_fetch_assoc($namecat);


$description = $nc['description'];
$keywords = $nc['keywords'];

include('../system/head.php');


$action=htmlspecialchars(trim($_GET['a']));

switch ($action){

default:
$pr=$_GET['id'];  
$namecat = mysql_query("SELECT * FROM `posts` WHERE `id` = '$pr' LIMIT 1");
$nc = mysql_fetch_assoc($namecat);
if(!mysql_num_rows($namecat)){
    echo 'ERROR! Post not exists!'; break;
}

echo '<div class="title">'.$nc['name'].'</div>';

    echo '<div id="imenu">';

$text = functions::bbcode($nc['text']);

echo '<div class="text">'.functions::smileys($text).'</div>';

/* LIKES */
if($uid){
echo '<p><div class="like">';
$golosovav = mysql_query("SELECT * FROM `likes` WHERE `pid` = '$pr' AND `uid` = '$uid'");
if(!mysql_num_rows($golosovav)){ // Якщо не лайкав

  echo '<a href="../likes/index.php?a=like&amp;id='.$pr.'"><img src="../design/'.$user['design'].'/img/like.png"></a>';  
}else{ //Якщо вже лайкнув
 echo '<a href="../likes/index.php?a=dislike&amp;id='.$pr.'"><img src="../design/'.$user['design'].'/img/like1.png"></a>';   
}
echo '</div></p>';//like
}
    echo '</div>';
$golosov = mysql_result(mysql_query("SELECT COUNT(*) FROM `likes` WHERE `pid` = '$pr'"), 0);
echo '<div class="small"><a href="../likes/index.php?a=see&amp;id='.$nc['id'].'" class="url">'.$lang['like'].': '.$golosov.'</a></div>';


/* LIKES */

/* COMMENTS */
$comments = mysql_result(mysql_query("SELECT COUNT(*) FROM `comments` WHERE `pid` = '$pr'"), 0);

echo '<div class="small"><a class="url" href="../comments/index.php?id='.$pr.'">'.$lang['comments'].': '.$comments.'</a></div>';
echo '<div class="small"><a class="url" href="../posts/index.php?id='.$pr.'">'.$lang['added'].': '.date("d.m.Y / H:i", $nc['time']).'</a></div>';
/* COMMENTS */
echo '<div class="title">'.$lang['scopy'].'</div>';
echo '<div class="small">';
echo "- $lang[ssulka]<br />";
echo '<input type="name" value="http://'.$set['home'].'/posts/index.php?id='.$nc['id'].'"></input><br />';
echo '- BB Code<br />';
echo '<input type="name" value="[url=http://'.$set['home'].'/posts/index.php?id='.$nc['id'].']'.$nc['name'].'[/url]"></input>';
echo '</div>';

echo '<div class="title"><a href="../cat/index.php?id='.$nc['catid'].'">'.$lang['back'].'</a></div>';

echo '<div class="small" style="display: none">Описание: '.$nc['description'].'<br />Ключевые слова: '.$nc['keywords'].'</div>';

break;


}
$title = "$nc[name]"; //Титл для низа страницы, для СЕО оптимизации желательно укзаывать

include('../system/foot.php');

/**
 * @author FROSTY (valik619)
 * @site nadmad.ru
 * @mail valik619@inbox.ru
 */

?>